/**
 * <copyright>
 * </copyright>
 *
 * $Id: ActorImpl.java 483 2007-04-03 03:07:06Z petterei $
 */
package biz.modelx.precise.usecase.ui.model.eusecase.impl;

import biz.modelx.precise.ui.model.eprecise.impl.PNameableImpl;

import biz.modelx.precise.usecase.ui.model.eusecase.Actor;
import biz.modelx.precise.usecase.ui.model.eusecase.EusecasePackage;
import biz.modelx.precise.usecase.ui.model.eusecase.Usecase;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Actor</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link biz.modelx.precise.usecase.ui.model.eusecase.impl.ActorImpl#getUsecases <em>Usecases</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ActorImpl extends PNameableImpl implements Actor {
	/**
	 * The cached value of the '{@link #getUsecases() <em>Usecases</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUsecases()
	 * @generated
	 * @ordered
	 */
	protected EList<Usecase> usecases;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ActorImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return EusecasePackage.Literals.ACTOR;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Usecase> getUsecases() {
		if (usecases == null) {
			usecases = new EObjectWithInverseResolvingEList.ManyInverse<Usecase>(Usecase.class, this, EusecasePackage.ACTOR__USECASES, EusecasePackage.USECASE__ACTORS);
		}
		return usecases;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case EusecasePackage.ACTOR__USECASES:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getUsecases()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case EusecasePackage.ACTOR__USECASES:
				return ((InternalEList<?>)getUsecases()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case EusecasePackage.ACTOR__USECASES:
				return getUsecases();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case EusecasePackage.ACTOR__USECASES:
				getUsecases().clear();
				getUsecases().addAll((Collection<? extends Usecase>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case EusecasePackage.ACTOR__USECASES:
				getUsecases().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case EusecasePackage.ACTOR__USECASES:
				return usecases != null && !usecases.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ActorImpl
